import { Component } from "react";
import { Link, Route } from "react-router-dom";
import User from "./components/User/User";
import Home from "./components/Home/Home";

/**
 * 最外层包裹了一个<BrowserRouter>或<HashRouter>
 * 路由切换使用Link标签
 *    <Link to="/xxx"></Link>
 * 展示区用Route标签进行路径的匹配
 *    <Route path="匹配的路径" component={展示的组件}>
 */

class App extends Component {
  render() {
    return (
      <div>
        <Link to="/user">显示User</Link>
        <br></br>
        <Link to="/home">显示Home</Link>
        <hr></hr>
        <Route path="/user" component={User}></Route>
        <Route path="/home" component={Home}></Route>
      </div>
    );
  }
}

export default App;
